#include "GW_AdrDial.h"

void GW_AdrDial::init()
{

}

void GW_AdrDial::read(u8 *buf, int length)
{

   u8 addr=~(HAL_GPIO_ReadPin(ADR0_GPIO_Port, ADR0_Pin)|HAL_GPIO_ReadPin(ADR1_GPIO_Port, ADR1_Pin)<<1
      |HAL_GPIO_ReadPin(ADR2_GPIO_Port, ADR2_Pin)<<2|HAL_GPIO_ReadPin(ADR3_GPIO_Port, ADR3_Pin)<<3
      |HAL_GPIO_ReadPin(ADR4_GPIO_Port, ADR4_Pin)<<4|HAL_GPIO_ReadPin(ADR5_GPIO_Port, ADR5_Pin)<<5)&0x3f;
   if (length==sizeof(int))
   {
      int *ptr;
      ptr = (int *)buf;
      *ptr = addr;
   }
}

int GW_AdrDial::load()
{
// map<int,GW_HDW *> *sys = this->getSys_Devs();
// this->HW_id = (*sys).size();
// (*sys)[this->HW_id]=this;
   this->init();
   return 1;
   //return GW_HDW::load();
   //return this->HW_id;
   //sys->push_back(this);
}
